package refactorplugin.views;

import java.util.LinkedList;
import java.util.List;

public class TreeComposite extends TreeComponent {
	
	private List<TreeComponent> _children;

	@Override
	public boolean isLeaf() {
		return false;
	}
	
	public TreeComposite(String name) {
		super(name);
		_children = new LinkedList<TreeComponent>();
	}
	
	public void addChild(TreeComponent child) {
		_children.add(child);
		child.setParent(this);
	}
	
	public void removeChild(TreeComponent child) {
		_children.remove(child);
		child.setParent(null);
	}
	
	public List<TreeComponent> getChildren() {
		return _children;
	}
	
	public boolean hasChildren() {
		return _children.size()>0;
	}
}
